﻿<MudDialog>
    <DialogContent>
        Dialog Content
        <MudTextField T="string" Immediate TextChanged="@(text=>OnTextChanged(text))"/>
        <div @onclick="OnClick">
            Click here!
        </div>
    </DialogContent>
    <DialogActions>
        <MudButton OnClick="Cancel">Cancel</MudButton>
        <MudButton Color="Color.Primary" OnClick="Submit">Ok</MudButton>
    </DialogActions>
</MudDialog>


@code {
    [CascadingParameter] MudDialogInstance MudDialog { get; set; }

    [Parameter] public EventCallback<string> OnSearch { get; set; }
    [Parameter] public EventCallback OnClick { get; set; }

    void Submit() => MudDialog.Close(DialogResult.Ok(true));
    void Cancel() => MudDialog.Cancel();

    async void OnTextChanged(string text) {
        await OnSearch.InvokeAsync(text);
    }
}
